//
//  BaseTableViewController.swift
//  Weibo
//
//  Created by mac on 15/11/26.
//  Copyright © 2015年 zsl. All rights reserved.
//

import UIKit

class BaseTableViewController: UITableViewController ,VisitorLoginViewDelegate{

   //添加一个用户是否登录的标记
    var userLogin = false
    
    //给baseTableVC 添加访客视图属性
    var visitorLoginView: VisitorLoginView?
    
    
    
    
    override func loadView() {
        
        //自定义视图
      //  userLogin ? super.loadView() : setVisitorView()
        setVisitorView()
    }

    private func setVisitorView(){
        
        //自定义访客视图
       visitorLoginView = VisitorLoginView()
        visitorLoginView?.visitorLoginViewDelegate = self
        //view = visitorLoginView
        
        
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登录", style: .Plain, target: self, action: "userWillLogin")
       
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: .Plain, target: self, action: "userWillRegister")
    }
    
    func userWillLogin (){
        
        let oathController = OAuthViewController()
        let nav = UINavigationController(rootViewController: oathController)
        
        presentViewController(nav, animated: true , completion: nil)
        
    }
    func userWillRegister (){
        print(__FUNCTION__)
    }
    
    
}
